import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TDescUpon } from "../../../Message/Db/Tables/TDescUpon";
import { DescUtil } from "../../common/DescUtil";
type int = number;
//class DescConfig
    
    export  class DescConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (DescConfig._instance != null) 
            {
                throw new Error(" DelegateConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_desc_upon.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TDescUpon();
                loc1.id = loc2.id;
                loc1.desc = loc2.desc;
                this._map[loc1.id] = loc1;
            }
            return;
        }

        public getDescById(arg1: int): string
        {
            if (!this._map.hasOwnProperty(arg1)) 
            {
                return "";
            }
            return (this._map[arg1] as TDescUpon).desc;
        }

        public getDescAlyzObj(arg1: int, arg2: Object): string
        {
            var loc1=this.getDescById(int(arg1));
            return DescUtil.analyzeStr(loc1, arg2);
        }

        public static get instance(): DescConfig
        {
            if (DescConfig._instance == null) 
            {
                DescConfig._instance = new DescConfig();
            }
            return DescConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: DescConfig;
    }
